<?php
class ml_model_atNick_rds extends ml_model_redis  {
    
    const PFX_ATNICK_TMP = 'atTmp:';
    const SORT_LIMIT_COUNT = 9;//10
    const TMP_CACHE_TIME = 60;
    
    function __construct() {
        if(!$this->init_rds('meila_cache'))
            return false;
    }
    
    

    //@todo 事务
    public function get_atNick_nickbyfollowlist($key, $uid){
        $spell = trim($key);
        
        $latestlist = ml_model_atNick_rdsFollowList::PFX_SET_ATNICK_LATESTAT.$uid;
        $tmpKey = self::PFX_ATNICK_TMP.$uid.':'.$key;

        $length = Tool_string::count_all_character($spell);
        for ($i=0; $i<$length; $i++){
            $key = Tool_string::substr_by_charater($spell, $i, 1);            
            $key = ml_model_atNick_rdsAtNick::PFX_ATNICK_NICK_INDEX.$key.'@'.$i;;
            $keylist[] = $key;
        }
        $keylist[] = ml_model_atNick_rdsFollowList::PFX_SET_ATNICK_FOLLOWLIST.$uid;
        
        //并集
        $rs = call_user_func_array ( array($this ,'sInter'), $keylist );

        //$re = $this->expireAt($tmpKey, self::TMP_CACHE_TIME);
        
        return $rs;
        
    }
}